package com.tfswue.qmp.controller;

import com.tfswue.qmp.service.EventPublisherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
//locoalhost:8080/user/register?username=xxx&email=xxx
@RequestMapping("/user")
public class RegestController {
    @Autowired
    private EventPublisherService eventPublisher;

    @PostMapping("/register")
    public ResponseEntity<String> registerUser(
            @RequestParam String username,
            @RequestParam String email){

     eventPublisher.publishUserRegistered(username, email);
     return ResponseEntity.ok("注册成功");

    }
}
